// call方法的原理：call函数所有方法都可以调用，在funtion的原型对象上添加要实现的函数
Function.prototype.write_call = function(thisArg, ...argArray) {
    thisArg = thisArg != undefined && thisArg != null ? Object(thisArg) : window;
    let fn = this;
    // 使用this绑定的隐式绑定，fn的this指向就指向thisArg了
    thisArg.fn = fn;
    let res = thisArg.fn(...argArray);
    delete thisArg.fn;
    return res;
};
function sum(num1,num2){
    console.log('sum函数被调用');
    console.log('this指向',this);
    return num1+num2
}
let res=sum.write_call(0,10,20);
console.log(res);
